<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!--使jsp输出的html时去除多余的空行  -->
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页_王政个人博客</title>
<meta name="keywords" content="个人博客,王政" />
<meta name="description" content="王政个人博客，用来存放一些实用网站。" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<%=basePath%>css/index.css" rel="stylesheet">
<link href="<%=basePath%>css/styleInput.css" rel="stylesheet">
<link href="<%=basePath%>css/button.css" rel="stylesheet">
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript" charset="utf-8"
	src="<%=basePath%>utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<%=basePath%>utf8-jsp/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8"
	src="<%=basePath%>utf8-jsp/lang/zh-cn/zh-cn.js"></script>

<!--酷炫文本框输入-->
<script type="text/javascript" src="<%=basePath%>js/coolInput.js"></script>
<!--引入jquery js/jquery-1.11.3.min.js-->
<script type="text/javascript" src="<%=basePath%>js/jquery-1.4.4.min.js"></script>
<!--引入自己写的js-->
<script type="text/javascript" src="<%=basePath%>js/tags.js"></script>
<script type="text/javascript" src="<%=basePath%>js/contents.js"></script>

</head>
<body>
	<div class="content_mid">
		<header>
		<div class="logo">
			<a href="#">王政的资料</a>
		</div>
		<nav>
		<ul id="starlist">
			<li><a href="index.html">网站首页</a></li>
			<li><a href="about.html">关于我</a></li>
			<li><a href="list.html">博客日记</a></li>
			<li><a href="info.html">慢生活</a></li>
			<li><a href="time.html">时间轴</a></li>
		</ul>
		</nav> </header>
		<!-- 搜索框 -->
		<div style="height: 45px;">

			<form action="<%=basePath%>serachByCondition" method="post"
				id="serachByCondition">
				<input type="text" placeholder="请输入主题名"
					style="width: 580px; margin-left: 350px; margin-top: 15px;"
					id="searchContent" name="condition">
				<button class="button_search" style="margin-top: -5px;" id="search"
					type="submit">搜索</button>
			</form>

		</div>

		<!-- 左侧标签栏 -->
		<div style="width: 175px;">
			<aside>
			<div class="ztbox">
				<ul id="tagsUl">
					<c:forEach items="${tags}" var="tag">
						<li id="li_id${tag.id }"><a href="javascript:void(0);"
							onclick="skipToLocation(${tag.id})">${tag.name}</a></li>
					</c:forEach>
				</ul>
			</div>
			</aside>
		</div>

		<!-- 右侧功能栏 -->
		<div style="position: absolute; right: -20px;">

			<asideRight>
			<button class="button" id="goToIndex" style="margin-top: 15px;">返回首页</button>
			</asideRight>
		</div>

	<!-- 主内容 -->
		<div class="box">

			<c:forEach items="${tags }" var="tag" varStatus="first">
				<c:if test="${tag.id %2!=0 }">
					<div class="newsbox f_l ">
						<div class="newstitle" id="tagLocation${tag.id }">
							<span><a href="javascript:void(0);"
								onclick="addContentByTagID(${tag.id})">+</a></span><b>${tag.name}</b>
						</div>
						<ul class="newsli">
							<c:forEach items="${contents }" var="item">
								<c:if test="${item.tag_id==tag.id }">
									<div class="contentItem">
										<span class="span_content">
											<li id="itemContent_${item.id }">${item.content }</li>
										</span> <span class="span_coperate"> <a
											href="javascript:void(0);"
											onclick="editContentById(${item.id})"><i
												class="fa fa-edit"></i></a><a
											href="javascript:void(0);" onclick="deleteById(${item.id})"><i
												class="fa fa-close"></i></a>
										</span>
									</div>
								</c:if>
							</c:forEach>

						</ul>
					</div>
				</c:if>

				<c:if test="${tag.id%2==0 }">
					<c:if test="${first.index==0 }">
						<div class="newsbox f_l ">
					</c:if>
					<c:if test="${first.index!=0 }">
						<div class="newsbox f_r ">
					</c:if>
					<!-- <div class="newsbox f_r "> -->
						<div class="newstitle" id="tagLocation${tag.id }">
							<span><a href="javascript:void(0);"
								onclick="addContentByTagID(${tag.id})">+</a></span><b>${tag.name }</b>
						</div>
						<ul class="newsli">
							<c:forEach items="${contents }" var="item" varStatus="num">
								<c:if test="${item.tag_id==tag.id }">
									<div class="contentItem">
										<span class="span_content">
											<li id="itemContent_${item.id }">${item.content }</li>
										</span> <span class="span_coperate"> <a
											href="javascript:void(0);"
											onclick="editContentById(${item.id})"><i
												class="fa fa-edit"></i></a> <a
											href="javascript:void(0);" onclick="deleteById(${item.id})"><i
												class="fa fa-close"></i></a>
										</span>
									</div>
								</c:if>
							</c:forEach>
						</ul>
					</div>
				</c:if>

			</c:forEach>




		</div>

	</div>

	<div class="content_footer">
		<div class="div_richText" hidden="hidden" id="richText">
			<!--富文本插件的使用-->
			<form action="<%=basePath%>addContentByTagID" method="post">
				<input type="hidden" name="tagId" id="addContent" />
				<textarea id="editor" type="text/plain" name="richContent"></textarea>
				<button type="submit" id="addContentButton"
					class="button_subAndEdit">提交</button>
			</form>
		</div>

		<div class="div_richText" hidden="hidden" id="richTextC">
			<!--富文本插件的使用-->
			<form action="<%=basePath%>editContentByID" method="post">
				<input type="hidden" name="contentId" id="editContent" />
				<textarea id="editorC" type="text/plain" name="richContentC"></textarea>
				<button type="submit" id="editContentButton"
					class="button_subAndEdit">修改</button>
			</form>
		</div>




		<footer>
		<p>
			Design by <a href="https://mail.163.com/" target="_blank">王政的个人资料</a>
		</p>
		<p>邮箱： walterlionking@163.com</p>
		</footer>
	</div>

	<!--引用富文本插件-->
	<script type="text/javascript">
		$(document).ready(function() {
			UE.delEditor('editor');
			var ue = UE.getEditor('editor').focus(); 
			
		});
		
	</script>
</body>
</html></html>